﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TA.JSON;

namespace TA.Turbo.Controls
{
	public class LoadNodesEventArgs : EventArgs, IJsonDeserializable
	{
		#region PUBLIC
		#region INIT
		public LoadNodesEventArgs(IJsonReader jr)
		{
			this.Deserialize(jr);
		}
		#endregion
		#region EVENTS
		#endregion
		#region PROPS
		public BaseTreeNode Node { get { return this._node; } }
		public string[] Exclude { get { return this._exclude; } }
		public TreeNodeCollection Result { get { return this._result; } }
		#endregion
		#region METHODS
		#endregion
		#endregion
		#region INTERNAL
		#region CONST/STATIC
		#endregion
		#region VARS
		BaseTreeNode _node = new ExpansionNode();
		TreeNodeCollection _result = new TreeNodeCollection();
		string[] _exclude;
		#endregion
		#region PROPS
		#endregion
		#region METHODS
		#region INIT
		#endregion
		#region DATA
		#endregion
		#region HANDLERS
		#endregion
		#endregion
		#endregion				
				
	
		#region IJsonDeserializable Members

		public void Deserialize(IJsonReader jr)
		{
			this.DeserializeObject(jr);
		}

		public void DeserializeContent(IJsonReader jr, string propShortName)
		{
			switch (propShortName)
			{
				case "X":
					List<string> t = new List<string>();
					jr.Read(JsonToken.StartArray);
					while (jr.TokenType == JsonToken.String)
					{
						t.Add((string)jr.Value);
						jr.Read();
					}
					jr.Expect(JsonToken.EndArray);
					this._exclude = t.ToArray();
					break;
				default:
					this.Node.DeserializeContent(jr, propShortName);
					break;
			}
		}

		#endregion
	}
}
